package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.ReportModelApiService;
import com.yixun.qfbao.apidto.GetReportModelContentReqDto;
import com.yixun.qfbao.apidto.GetReportModelContentResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetReportModelContentReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GetReportModelContentHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetReportModelContentHander.class);
    @Autowired
    private ReportModelApiService reportModelApiService;

    @SuppressWarnings("rawtypes")
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetReportModelContentReqVo req = (GetReportModelContentReqVo)reqDto;
        GetReportModelContentReqDto reqDto1 = req.getParams();
        BaseResponseDTO<GetReportModelContentResDto> res = new BaseResponseDTO<GetReportModelContentResDto>();
        GetReportModelContentResDto resDto = new GetReportModelContentResDto();
        try {
            resDto = reportModelApiService.getReportModelContent(reqDto1);
        } catch (Exception e) {
            logger.error("GetReportModelContentHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg(resDto.getResultMsg());
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
